<html>
<!-- Use Meta.transform to set range of horizontal values -->
<style>
 {{{defaultstyle}}}
 body {margin: 20px 20px; font-family: Tahoma}
 table {width: 100%; box-shadow: 5 5 10 #777;}
 td, th {border: solid #ccc 1px; font-size: 12px; padding: 2 2; }
 th {background: #888; color: white; padding: 5px 5px; draggable: true; }
 .total {background: #888; color: white}
 tr.odd {background: #eee}
 .cust {font-weight: bold}

</style>

<h1 align="center">Sales by Months and Years</h1>

<h2>1. Sales by Month</h2>

<DATAPACKET>
 <METADATA transform="1-12" autosort="true">
  <FIELDS>
   <FIELD name="COMPANY" total="Total" class="cust"/>
   <FIELD name="*" format="# ### ###.##" align="right" total="sum"/>
  </FIELDS>
  <SQL>
   select c.company, extract(month from saledate) field, sum(itemstotal) "VALUE"
   from customer c join orders o on o.custno=c.custno
   group by 1,2
   order by 1
  </SQL>
 </METADATA>
</DATAPACKET>

<br>
<h2>2. Sales by Year</h2>


<DATAPACKET>
 <METADATA transform="1988-1995" autosort="true">
  <FIELDS>
   <FIELD name="COMPANY" total="Total" class="cust"/>
   <FIELD name="*" format="# ### ###.##" align="right" total="sum"/>
  </FIELDS>
  <SQL>
   select c.company, extract(year from saledate) field, sum(itemstotal) "VALUE"
   from customer c join orders o on o.custno=c.custno
   group by 1,2
   order by 1
  </SQL>
 </METADATA>
</DATAPACKET>


</html>
